package com.ssvendas.modelo;

import java.io.Serializable;
import java.util.ArrayList;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

@Entity
public class Usuario implements Serializable{
	
	private static final long serialVersionUID = 6059966868482408038L;

	@Id
	@SequenceGenerator(sequenceName="USUARIO_SEQ",allocationSize = 1, name = "ID_USUARIO")
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="ID_USUARIO")
	private String id;
	
	private String nome;
	
	private String senha;
	
	@Column(unique=true)
	private String email;

	@OneToMany(fetch=FetchType.EAGER)
	@JoinColumn(name="VENDEDOR_ID")
	private ArrayList<Venda> vendas;
	
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public ArrayList<Venda> getVendas() {
		return vendas;
	}

	public void setVendas(ArrayList<Venda> vendas) {
		this.vendas = vendas;
	}

}
